package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.entity.SysReport;
import com.gec.model.vo.SysReportQueryVo;
import com.gec.system.mapper.SysReportMapper;
import com.gec.system.service.SysReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 公告表 服务实现类
 * </p>
 *
 * @author lxj
 * @since 2024-03-07
 */
@Service
public class SysReportServiceImpl extends ServiceImpl<SysReportMapper, SysReport> implements SysReportService {
    @Override
    public IPage<SysReport> selectPage(IPage<SysReport> page1, SysReportQueryVo vo) {
        return this.getBaseMapper().selectPage(page1, vo);
    }

    @Override
    public boolean addViews(Long id) {
//        QueryWrapper<SysReport> queryWrapper=new QueryWrapper<>();
//        queryWrapper.eq("id", id);
        SysReport sysReport=this.baseMapper.selectById(id);
        sysReport.setViews(sysReport.getViews()+1);
        int i = this.baseMapper.updateById(sysReport);

        return i>0;
    }
}
